package cn.wolfcode.Config;

import cn.wolfcode.intercepter.LoginIntercepter;
import cn.wolfcode.intercepter.PermissionIntercepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    public static final  String[] excludePathPatterns = {"/css/**","/img/**",
            "/js/**", "/login.html",
            "/UserLogin", "/index", "/indexMessage", "/appointment/selectByBussiness", "/appointment/selectBySn",
            "/appointment/save", "/messageBoard/indexMessage", "/messageBoard/massageItem",
            "/messageBoard/saveOrUpdate", "/systemDictionaryItem/selectByParentId", "/d/list",
            "/d/delete"
    };
    @Autowired
    private LoginIntercepter loginIntercepter;
    @Autowired
    private PermissionIntercepter permissionIntercepter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercepter).addPathPatterns("/**").excludePathPatterns(excludePathPatterns);
        registry.addInterceptor(permissionIntercepter).addPathPatterns("/**").excludePathPatterns(excludePathPatterns).excludePathPatterns("/login.html");


    }
}
